package com.changan.stumgr.mapper;

import com.changan.stumgr.pojo.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StudentMapper {


    List<Student> selAllStudent(Student student);

    @Insert("INSERT INTO `student`(`id`, `name`, `sex`, `gradeId`) VALUES (null, #{name}, #{sex}, #{gradeId})")
    int addStudent(Student student);

    @Delete("delete from student where id = #{id}")
    int delStudent(Integer id);

    @Update("UPDATE `student` SET `name` = #{name}, `sex` = #{sex}, `gradeId` = #{gradeId} WHERE `id` = #{id}")
    int updateStudent(Student student);

    @Select("select * from student where id = #{id}")
    List<Student> findStudentById(Integer id);
}
